
function Task(){

    let timer = null ;
    let counter = 1 ;

    function showTime(){
        console.log( Date.now() );
        counter++;
        if( counter === 10 ) {
            clearInterval( timer );
        }
    }

    this.start = function(){
        timer = setInterval( showTime , 1000 );
    }
}

let t = new Task();
t.start();
